package com.link.controller;

import com.link.service.GitPullService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

import java.util.Date;

/**
 * @ClassName DsComponent
 * @Description TODO
 * @Author linK
 * @Date 2023/12/6 10:15
 * @Version 1.0
 **/
@Component
public class DsComponent {
    private GitPullService gitPullService;

    @Autowired
    public void setGitPullService(GitPullService gitPullService) {
        this.gitPullService = gitPullService;
    }

    //@Scheduled(fixedRate = 5000) // 每隔5秒执行一次
    //@Scheduled(cron = "0 0 0 * * ?")
    @Scheduled(cron = "0 0 */12 * * ?")
    public void printCurrentTime() {
        System.out.println("定时任务执行：" + new Date());
        gitPullService.gitPull();
    }


}
